import { IPSModelSortable } from '../../ipsmodel-sortable';
import { IPSAppDEACMode } from '../../app/dataentity/ipsapp-deacmode';
import { IPSAppDEField } from '../../app/dataentity/ipsapp-defield';
import { IPSAppView } from '../../app/view/ipsapp-view';
import { IPSDEACMode } from './ipsdeacmode';
import { IPSDEACModeDataItem } from './ipsdeacmode-data-item';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEACModeImpl extends PSModelObjectImpl implements IPSDEACMode, IPSAppDEACMode, IPSModelSortable {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get emptyText(): string {
    return this.M.emptyText;
  }

  protected emptytextpslanguageres: IPSLanguageRes | null = null;

  getEmptyTextPSLanguageRes(): IPSLanguageRes | null {
    if (this.emptytextpslanguageres != null) return this.emptytextpslanguageres;
    const value = this.M.getEmptyTextPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.emptytextpslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getEmptyTextPSLanguageRes') as IPSLanguageRes;
    return this.emptytextpslanguageres;
  }

  get emptyTextPSLanguageRes(): IPSLanguageRes | null {
    return this.getEmptyTextPSLanguageRes();
  }

  getEmptyTextPSLanguageResMust(): IPSLanguageRes {
    const value = this.getEmptyTextPSLanguageRes();
    if (value == null) {
      throw new Error('未指定无值内容语言资源');
    }
    return value;
  }

  get extendMode(): 0 | 2 {
    return this.M.extendMode != null ? this.M.extendMode : 0;
  }

  protected itempssyspfplugin: IPSSysPFPlugin | null = null;

  getItemPSSysPFPlugin(): IPSSysPFPlugin | null {
    if (this.itempssyspfplugin != null) return this.itempssyspfplugin;
    const value = this.M.getItemPSSysPFPlugin;
    if (value == null) {
      return null;
    }
    this.itempssyspfplugin = this.getPSModel4('res.IPSSysPFPlugin', value, 'getItemPSSysPFPlugin') as IPSSysPFPlugin;
    return this.itempssyspfplugin;
  }

  get itemPSSysPFPlugin(): IPSSysPFPlugin | null {
    return this.getItemPSSysPFPlugin();
  }

  getItemPSSysPFPluginMust(): IPSSysPFPlugin {
    const value = this.getItemPSSysPFPlugin();
    if (value == null) {
      throw new Error('未指定前端扩展插件');
    }
    return value;
  }

  get logicName(): string {
    return this.M.logicName;
  }

  get memo(): string {
    return this.M.memo;
  }

  get minorSortDir(): 'ASC' | 'DESC' {
    return this.M.minorSortDir;
  }

  protected minorsortpsappdefield: IPSAppDEField | null = null;

  getMinorSortPSAppDEField(): IPSAppDEField | null {
    if (this.minorsortpsappdefield != null) return this.minorsortpsappdefield;
    const value = this.M.getMinorSortPSAppDEField;
    if (value == null) {
      return null;
    }
    this.minorsortpsappdefield = this.getPSModel4('app.dataentity.IPSAppDEField', value, 'getMinorSortPSAppDEField') as IPSAppDEField;
    return this.minorsortpsappdefield;
  }

  get minorSortPSAppDEField(): IPSAppDEField | null {
    return this.getMinorSortPSAppDEField();
  }

  getMinorSortPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getMinorSortPSAppDEField();
    if (value == null) {
      throw new Error('未指定从排序应用属性对象');
    }
    return value;
  }

  get name(): string {
    return this.M.name;
  }

  get orderValue(): number {
    return this.M.orderValue != null ? this.M.orderValue : 99999;
  }

  protected psdeacmodedataitems: IPSDEACModeDataItem[] | null = null;

  getPSDEACModeDataItems(): IPSDEACModeDataItem[] | null {
    if (this.psdeacmodedataitems == null) {
      this.psdeacmodedataitems = this.fillChildListModel(this.M.getPSDEACModeDataItems, 'dataentity.ac.IPSDEACModeDataItem') as IPSDEACModeDataItem[];
    }
    return this.psdeacmodedataitems;
  }

  get psDEACModeDataItems(): IPSDEACModeDataItem[] | null {
    return this.getPSDEACModeDataItems();
  }

  findPSDEACModeDataItem(objKey: any): IPSDEACModeDataItem | null {
    return this.getPSModel5('dataentity.ac.IPSDEACModeDataItem', this.getPSDEACModeDataItems(), objKey) as IPSDEACModeDataItem;
  }

  get pagingSize(): number {
    return this.M.pagingSize;
  }

  protected pickuppsappview: IPSAppView | null = null;

  getPickupPSAppView(): IPSAppView | null {
    if (this.pickuppsappview != null) return this.pickuppsappview;
    const value = this.M.getPickupPSAppView;
    if (value == null) {
      return null;
    }
    this.pickuppsappview = this.getPSModel4('app.view.IPSAppView', value, 'getPickupPSAppView') as IPSAppView;
    return this.pickuppsappview;
  }

  get pickupPSAppView(): IPSAppView | null {
    return this.getPickupPSAppView();
  }

  getPickupPSAppViewMust(): IPSAppView {
    const value = this.getPickupPSAppView();
    if (value == null) {
      throw new Error('未指定嵌入选择视图');
    }
    return value;
  }

  protected textpsappdefield: IPSAppDEField | null = null;

  getTextPSAppDEField(): IPSAppDEField | null {
    if (this.textpsappdefield != null) return this.textpsappdefield;
    const value = this.M.getTextPSAppDEField;
    if (value == null) {
      return null;
    }
    this.textpsappdefield = this.getPSModel4('app.dataentity.IPSAppDEField', value, 'getTextPSAppDEField') as IPSAppDEField;
    return this.textpsappdefield;
  }

  get textPSAppDEField(): IPSAppDEField | null {
    return this.getTextPSAppDEField();
  }

  getTextPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getTextPSAppDEField();
    if (value == null) {
      throw new Error('未指定文本应用属性对象');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  protected valuepsappdefield: IPSAppDEField | null = null;

  getValuePSAppDEField(): IPSAppDEField | null {
    if (this.valuepsappdefield != null) return this.valuepsappdefield;
    const value = this.M.getValuePSAppDEField;
    if (value == null) {
      return null;
    }
    this.valuepsappdefield = this.getPSModel4('app.dataentity.IPSAppDEField', value, 'getValuePSAppDEField') as IPSAppDEField;
    return this.valuepsappdefield;
  }

  get valuePSAppDEField(): IPSAppDEField | null {
    return this.getValuePSAppDEField();
  }

  getValuePSAppDEFieldMust(): IPSAppDEField {
    const value = this.getValuePSAppDEField();
    if (value == null) {
      throw new Error('未指定值应用属性对象');
    }
    return value;
  }

  get defaultMode(): boolean {
    return this.M.defaultMode;
  }

  get enablePagingBar(): boolean {
    return this.M.enablePagingBar;
  }

  get cls(): string {
    return 'PSDEACModeImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'IPSModelSortable' || cls == 'app.dataentity.IPSAppDEACMode' || cls == 'dataentity.ac.IPSDEACMode') return true;
    return super.instanceof(cls);
  }
}
